package com.trainoo.payment.mock.util;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * <p> add description here </p>
 *
 * @author tao.zhou
 * @version 1.0
 * @date 2021/12/2 17:11:00
 */
public class DateUtil {

    public static final String yyyyMMdd = "yyyyMMdd";
    public static final String YMDSTRING_DATA = "yyyyMMddHHmmss";

    public static String getYMDStr() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(new Date());
    }

    public static String getDateFormat(Date date, String format) {
        String result = "";

        try {
            if (date != null) {
                DateFormat dateFormat = new SimpleDateFormat(format);
                result = dateFormat.format(date);
            }
        } catch (Exception var4) {
            var4.printStackTrace();
        }

        return result;
    }
}
